/**
 * 
 */
package com.googlecode.rotools.rodb;

/**
 * 
 */
public class ItemSlot {
	private static final int MOUTH = 1;
	private static final int RIGHT_HAND = 2;
	private static final int SHOULDER = 4;
	private static final int RIGHT_ACCESSORY = 8;
	private static final int BODY = 16;
	private static final int LEFT_HAND = 32;
	private static final int FOOT = 64;
	private static final int LEFT_ACCESSORY = 128;
	private static final int HEAD = 256; 
	private static final int FACE = 512;
	
	private int value;
	
	public ItemSlot() {
		super();
	}
	public ItemSlot(int value) {
		super();
		setValue(value);
	}
	void setValue(int value){
		this.value = value;
	}
	
	/**
	 * @return the value
	 */
	public int getValue() {
		return value;
	}
	public boolean isHead(){
		return 0 != (value & HEAD);
	}
	public boolean isFace(){
		return 0 != (value & FACE);
	}
	public boolean isMouth(){
		return 0 != (value & MOUTH);
	}
	public boolean isShoulder(){
		return 0 != (value & SHOULDER);
	}
	public boolean isBody(){
		return 0 != (value & BODY);
	}
	public boolean isLeftHand(){
		return 0 != (value & LEFT_HAND);
	}
	public boolean isRightHand(){
		return 0 != (value & RIGHT_HAND);
	}
	public boolean isLeftAccessory(){
		return 0 != (value & LEFT_ACCESSORY);
	}
	public boolean isRightAccessory(){
		return 0 != (value & RIGHT_ACCESSORY);
	}
	public boolean isFoot(){
		return 0 != (value & FOOT);
	}
	private void setValue(boolean value, int bit){
		if(value){
			this.value |= bit;
			
		}else{
			this.value ^= bit;
			
		}
	}
	public void setHead(boolean value){
		setValue(value, HEAD);
	}
	public void setFace(boolean value){
		setValue(value, FACE);
	}
	public void setMouth(boolean value){
		setValue(value, MOUTH);
	}
	public void setShoulder(boolean value){
		setValue(value, SHOULDER);
	}
	public void setBody(boolean value){
		setValue(value, BODY);
	}
	public void setLeftHand(boolean value){
		setValue(value, LEFT_HAND);
	}
	public void setRightHand(boolean value){
		setValue(value, RIGHT_HAND);
	}
	public void setLeftAccessory(boolean value){
		setValue(value, LEFT_ACCESSORY);
	}
	public void setRightAccessory(boolean value){
		setValue(value, RIGHT_ACCESSORY);
	}
	public void setFoot(boolean value){
		setValue(value, FOOT);
	}
}

